<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        {
            let arr = [1,2,3,4]
            // arr.indexOf('a');
            // let val = arr.find((item,index)=>{
            //     if(item >= 4){
            //         return true;
            //     }
            // })
            val = arr.find(item=>item>=2)//获取大于2的值的第一个index
            console.log(val);



            // let index = arr.findIndex(item=>item>=3)//获取index的值
            // console.log(index);
        }
    </script>
</body>
</html>